#include "existsExpression.h"

ExistsExpression::ExistsExpression(QueryTree * query){
	this->query= query->clone();
}

ExistsExpression::ExistsExpression(){
	this->query = NULL;
}

ExistsExpression::~ExistsExpression(){
	delete query;
	query = NULL;
}

std::string ExistsExpression::toString(){
    std::string str="EXISTS (";
    if(query != NULL){
        str = str + query->toString();
    }//if
    
    str=str+")";

    return str;
}

Expression* ExistsExpression::clone(){
	return new ExistsExpression(query);
}

QueryTree * ExistsExpression::getQuery()
{
	return query;
}
